import http from "@/utils/http";

/**
 * @description: 根据user对象进行登录
 * @return {*}
 * @param user
 */
export function loginAPI(user){
    return http.post('/user/login',user);
}

/**
 * @description:发送登录验证码
 * @param user
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function sendLoginCodeAPI(user){
    return http.post('/user/sendLoginCode',user);
}

/**
 * sendPhoneCode 注册发送手机验证码
 * @param {object} params UserRequest
 * @param {string} params.phone
 * @returns
 */
export function sendPhoneCodeAPI(params) {
    return http.post(`/user/sendPhoneCode`, params);
}

/**
 * userRegister
 * @param {object} params UserRequest
 * @param {string} params.verCode
 * @param {string} params.phone
 * @returns
 */
export function userRegisterAPI(params) {
    return http.post(`/user/register`, params);
}

/**
 * userLogout
 * @returns
 */
export function userLogoutAPI() {
    return http.post(`/user/logout`);
}

/**
 * userUpdateBase
 * @param {object} params UserRequest
 * @param {string} params.userName
 * @param {string} params.mail
 * @param {string} params.phone
 * @param {object} params.birthday
 * @param {string} params.gender
 * @returns
 */
export function userUpdateBaseAPI(params) {
    return http.post(`/user/updateBasic`, params);
}

